package com.genreate.util.xyzw;

import java.util.List;

// 太史慈 - 箭无虚发 (主动技能)
class JianWuXuFa implements Skill {
    @Override
    public String getName() {
        return "箭无虚发";
    }

    @Override
    public void execute(Hero caster, List<Hero> targets) {
        System.out.println(caster.name + " 发动箭无虚发，对敌方后排造成高额伤害!");

        for (Hero target : targets) {
            if (target.isAlive && (target.position == Position.BACK_LEFT ||
                    target.position == Position.BACK_MIDDLE ||
                    target.position == Position.BACK_RIGHT)) {
                int damage = caster.attack * 220 / 100; // 220%攻击力伤害

                if (caster.isCriticalHit()) {
                    float critMultiplier = caster.getCritDamageMultiplier();
                    damage *= critMultiplier;
                    System.out.println("暴击! 伤害倍率: " + critMultiplier);
                }

                target.takeDamage(caster, damage);
            }
        }
    }
}
